package bairui.international.model.status;

/**
 *
 * (分公司员工提现单状态)State_BranchCompanyStaffWithdrawOrder
 */
@com.lianjing.sh.processing.info.annotation.GenerateInfoModel
@com.lianjing.sh.model.common.annotation.Comment("分公司员工提现单状态")
@com.lianjing.sh.processing.info.annotation.InfoComment("分公司员工提现单状态")
public enum State_BranchCompanyStaffWithdrawOrder implements com.sh_lianjing.state.Statable, com.sh_lianjing.standard.EnumCommentable<State_BranchCompanyStaffWithdrawOrder> {

	/**
	 * <b>状态:</b> </br>
	 * (审核不通过)VerifyNoPass</br>
	 */
	@com.lianjing.sh.model.common.annotation.Comment("审核不通过")
	@com.lianjing.sh.processing.info.annotation.InfoComment("审核不通过")
	VerifyNoPass("审核不通过")
,
	/**
	 * <b>状态:</b> </br>
	 * (已取消)Canceled</br>
	 */
	@com.lianjing.sh.model.common.annotation.Comment("已取消")
	@com.lianjing.sh.processing.info.annotation.InfoComment("已取消")
	Canceled("已取消")
,
	/**
	 * <b>状态:</b> </br>
	 * (待审核)Verifing</br>
	 */
	@com.lianjing.sh.model.common.annotation.Comment("待审核")
	@com.lianjing.sh.processing.info.annotation.InfoComment("待审核")
	Verifing("待审核")
,
	/**
	 * <b>状态:</b> </br>
	 * (完成)Finished</br>
	 */
	@com.lianjing.sh.model.common.annotation.Comment("完成")
	@com.lianjing.sh.processing.info.annotation.InfoComment("完成")
	Finished("完成")
;

	private static java.util.Map<String, State_BranchCompanyStaffWithdrawOrder> Cache = new java.util.HashMap<>();
	static{
		for(State_BranchCompanyStaffWithdrawOrder enumItem : State_BranchCompanyStaffWithdrawOrder.values()){
			Cache.put(enumItem.getComment(), enumItem);
		}
	}

	private String comment;

	private State_BranchCompanyStaffWithdrawOrder(String comment){
		this.comment = comment;
	}

	@Override
	public String toString() {
		return comment;
	}

	@Override
	public String getComment() {
		return comment;
	}

	/**
	 * 通过备注解析状态相关
	 */
	@Override
	public State_BranchCompanyStaffWithdrawOrder parseByComment(String comment) {
		return State_BranchCompanyStaffWithdrawOrder.parse(comment);
	}

	public static State_BranchCompanyStaffWithdrawOrder parse(String comment) {
		State_BranchCompanyStaffWithdrawOrder enumItem = Cache.get(comment);
		if(null == enumItem){
			 throw new com.sh_lianjing.standard.exception.EnumCommentableException(State_BranchCompanyStaffWithdrawOrder.class, comment);
		}
		return enumItem;
	}

	/**
	 * from 转换方法相关
	 */
	/** <b>创建</b> */
	public static com.sh_lianjing.state.StateTransition<State_BranchCompanyStaffWithdrawOrder> t_create() {
		return new com.sh_lianjing.state.StateTransition<State_BranchCompanyStaffWithdrawOrder>("创建", null, Verifing);
	}

	/** <b>审核(待审核状态)不通过</b> */
	public com.sh_lianjing.state.StateTransition<State_BranchCompanyStaffWithdrawOrder> t_verifyNoPass_from_Verifing() throws com.sh_lianjing.state.StateConvertException {
		if(this != Verifing){
			throw new com.sh_lianjing.state.StateConvertException(this, VerifyNoPass);
		}
		return new com.sh_lianjing.state.StateTransition<State_BranchCompanyStaffWithdrawOrder>("审核不通过", this, VerifyNoPass);
	}

	/** <b>审核(待审核状态)通过</b> */
	public com.sh_lianjing.state.StateTransition<State_BranchCompanyStaffWithdrawOrder> t_verifyPass_from_Verifing() throws com.sh_lianjing.state.StateConvertException {
		if(this != Verifing){
			throw new com.sh_lianjing.state.StateConvertException(this, Finished);
		}
		return new com.sh_lianjing.state.StateTransition<State_BranchCompanyStaffWithdrawOrder>("审核通过", this, Finished);
	}

	/** <b>取消(审核不通过状态)</b> */
	public com.sh_lianjing.state.StateTransition<State_BranchCompanyStaffWithdrawOrder> t_cancel_from_VerifyNoPass() throws com.sh_lianjing.state.StateConvertException {
		if(this != VerifyNoPass){
			throw new com.sh_lianjing.state.StateConvertException(this, Canceled);
		}
		return new com.sh_lianjing.state.StateTransition<State_BranchCompanyStaffWithdrawOrder>("取消", this, Canceled);
	}

	/**
	 * to 转换方法相关
	 */

	/**
	 * 验证方法相关
	 */
	public Validator validator(){
		return new Validator();
	}
	
	public class Validator {
		private com.sh_lianjing.state.validate.StateCondition<State_BranchCompanyStaffWithdrawOrder> condition = new com.sh_lianjing.state.validate.StateCondition<>();
	
		public State_BranchCompanyStaffWithdrawOrder end() throws com.sh_lianjing.state.StateException{
			if(!condition.validate(State_BranchCompanyStaffWithdrawOrder.this)){
				throw new com.sh_lianjing.state.StateException("分公司员工提现单状态错误，不能执行操作");
			}
			return State_BranchCompanyStaffWithdrawOrder.this;
		}
	
		/** <b>验证[审核不通过]状态</b> */
		public Validator v_VerifyNoPass() {
			this.condition.add(VerifyNoPass);
			return this;
		}
		/** <b>验证[已取消]状态</b> */
		public Validator v_Canceled() {
			this.condition.add(Canceled);
			return this;
		}
		/** <b>验证[待审核]状态</b> */
		public Validator v_Verifing() {
			this.condition.add(Verifing);
			return this;
		}
		/** <b>验证[完成]状态</b> */
		public Validator v_Finished() {
			this.condition.add(Finished);
			return this;
		}
	}

}
